<html><!-- InstanceBegin template="/Templates/_Admin_Template.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- InstanceBeginEditable name="doctitle" -->
<title>TCedit 测试用例编写工具 - 测试用例分类编写</title>
<!-- InstanceEndEditable -->
<link rel="shortcut icon" href="favicon.ico">
<link href="/css/common.css" rel="stylesheet" type="text/css">
<script src="/js/jquery/jquery.js"></script>
<script src="/js/common.js"></script>
<script language="javascript">
#if($refreshTree == "create")
  #if($catalog.parentCatalogID==$ROOT_ID)
    pid="-1";
  #else
    pid="#"+"$!{catalog.parentCatalogID}";
  #end
  opener.parent.leftFrame.createTreeNode(pid, "$!{catalog.id}", "folder", "$!{catalog.name}");  
#elseif($refreshTree == "delete")
  parent.leftFrame.deleteTreeNode(getParam("id"));
#elseif($refreshTree == "update")
  #if($catalog.parentCatalogID==$ROOT_ID)
    pid="-1";
  #else
    pid="#"+"$!{catalog.parentCatalogID}";
  #end
  opener.parent.leftFrame.updateTreeNode(pid, "$!{catalog.id}", "$!{catalog.name}");
#end
#if($close)
  window.close();
#end

var tmpPID;
var tmpPName;

function doAction(action){
  if (action == "create") {
    document.formData.action = "/testCaseMgt/catalogForm.jspx?action=create";
  } else if (action == "update") {
    document.formData.action = "/testCaseMgt/catalogForm.jspx?action=update&id=${catalog.id}";
  } else if (action == "chooseCatalog") {
    window.open("/chooseCatalog.html?pid=" + $("#parentCatalogID").attr("value") + "&id=${catalog.id}", "", "width=" + window.screen.width*0.30 + ",height=450,left="+ window.screen.width*0.35 + ",top=" + (window.screen.height-450)/2 + ",toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no");
    return false;
  }
}
</script>
<script>
function checkForm(){
	if($("#name").attr("value")==""){
		alert("请输入“分类名称”！");
		return false;
	}

	return true;
}
function setParentCatalog(pID, pName) {
	$("#parentCatalogID").attr("value", pID);
	$("#parentCatalogName").attr("value", pName);
}
function setRoot(checked) {
	if(checked==true) {
		tmpPID=$("#parentCatalogID").attr("value");
		tmpPName=$("#parentCatalogName").attr("value");
		setParentCatalog("$!{ROOT_ID}", "$!{ROOT_NAME}");
		$("#chooseCatalog").attr("disabled","disabled").css({ "cursor": "default", "opacity": "0.4" });
	} else {
		setParentCatalog(tmpPID, tmpPName);
		$("#chooseCatalog").removeAttr("disabled").css({ "cursor": "pointer", "opacity": "1" });
	}
}
</script>
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
</head>

<body>
<table width="99%" align="center" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="100%" valign="top">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td></td>
          <td>
            #if($error)
              <font color="#FF0000">$error</font>
            #end
          </td>
        </tr>
        <form action="" method="post" enctype="multipart/form-data" name="formData" id="formData" onSubmit="return checkForm()">
        <tr>
          <td width="15%" align="right">父分类名称：</td>
          <td width="85%">
            <input name="parentCatalogName" type="text" id="parentCatalogName" style="width:50%;" maxlength="50" value="$!{parentCatalog.name}" disabled/>
            <input name="chooseCatalog" id="chooseCatalog" type="image" value="" src="../images/choose.bmp" onClick="return doAction('chooseCatalog')" />
            <input name="chkSetRoot" id="chkSetRoot" type="checkbox" value="" onclick="setRoot(this.checked);" /> 添加为根分类
            <input name="parentCatalogID" type="hidden" id="parentCatalogID" value="$!{parentCatalog.id}" />
          </td>
        </tr>
        <tr>
          <td width="15%" align="right">分类名称：</td>
          <td width="85%"><input name="name" type="text" class="text" id="name" style="width:50%;" maxlength="50" value="$!{catalog.name}" /> <b><font color="#FF0000">*</font></b></td>
        </tr>
        <tr>
          <td align="right">分类描述：</td>
          <td><input name="describing" type="text" class="text" id="describing" style="width:100%;" maxlength="100" value="$!{catalog.describing}" /></td>
        </tr>
        <tr>
          <td><BR></td>
          <td></td>
        </tr>
        <tr>
          <td></td>
          <td>
            #if($action=="" || $action=="create")
              <input name="SubmitCreate" type="submit" class="button" id="SubmitCreate" value="新增" onClick="doAction('create')" />
            #else
              #if (!($action=="delete"))
                <input name="SubmitUpdate" type="submit" class="button" id="SubmitUpdate" value="修改" onClick="doAction('update')" />
              #end
            #end
          </td>
          <td></td>
          <td></td>
        </tr>
        </form>
      </table>
    </td>
  </tr>
</table>
#if($parentCatalog.id==$ROOT_ID)
<script>
	$("#chooseCatalog").attr("disabled","disabled").css({ "cursor": "default", "opacity": "0.4" });
	$("#chkSetRoot").attr("checked","checked");
</script>
#end
</body>
<!-- InstanceEnd -->
</html>